#pragma once
#include "define.h"
#include "CPU.h"
#include "Human.h"
#include <iostream>
#include <vector>
#include <fstream>

using namespace std;

class CModel
{
public:
	CModel(void);
	~CModel(void);

	int initialization(int width, int height);
	int GetPlayState();
	bool Update(int input);
	int GetNext();
	int GetNumberPlayers() {return m_iNumberPlayers;};

	void GetPlayers(vector<CCPU> &CPU, vector<CHuman> &Human);
	//CCPU GetPlayer1();

private:
	_PlayState m_PlayState;
	int m_iNumberPlayers;
	int m_iNext;

	int m_iWidth;
	int m_iHeight;

	int m_iMapWidth;
	int m_iMapHeight;

	void SetNumberPlayer(int num);
	void SetCPU();
	void SetHuman();
	int SetPosition(int num);
	int SetPositionCPU();
	int Game(int input);

	int Random(int min, int max);

	void CheckDirection(vector<CHuman>::iterator human);
	void CheckDirection(vector<CCPU>::iterator CPU);
	int MoveIcon(vector<CHuman>::iterator human);

	int MoveIcon(vector<CCPU>::iterator CPU);
	int DirectionCPU(vector<CCPU>::iterator CPU);

	int Theft(vector<CCPU>::iterator CPU);
	int Theft(vector<CHuman>::iterator human);

	int Tip();

	//flag
	bool m_bIsFirst;

	vector<CCPU> m_CPU;
	vector<CHuman> m_Human;

	vector<char> m_vMap;
};
